package com.jiahao.material.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jiahao.material.entity.Menu;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MenuMapper extends BaseMapper<Menu> {

    @Results(id = "menuMap",value = {
            @Result(id = true,column = "id",property = "id"),
            @Result(column = "name",property = "name"),
            @Result(column = "parentId",property = "parentId"),
            @Result(column = "url",property = "url"),
            @Result(column = "icon",property = "icon"),
            @Result(column = "status",property = "status"),
            @Result(column = "sequence",property = "sequence")
    })
    @Select("select * from menu where id in (select mid from role_menu where rid = #{rid})")
    public List<Menu> getMenusByRid(String rid);
}
